package com.tianxiao.faas.application.web.corner;

import com.tianxiao.faas.api.param.corner.CustomInfoSaveParam;
import com.tianxiao.faas.application.aop.AuthenticationContextHolder;
import com.tianxiao.faas.biz.service.corner.CustomInfoService;
import com.tianxiao.faas.common.access.Access;
import com.tianxiao.faas.common.result.Result;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/app/info/")
public class CustomInfoController {

    @Resource
    private CustomInfoService customInfoService;

    @RequestMapping(value = "/save")
    @Access
    public Result<Boolean> save(@RequestBody CustomInfoSaveParam param) {
        Long userId = AuthenticationContextHolder.currentContext().getUserId();
        customInfoService.save(param, userId);
        return Result.builder().data(true).success(true);
    }
}
